package com.bsc.rtc.lib.libraries.Video;

import android.os.Environment;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import com.bsc.rtc.lib.libraries.R;

import java.io.IOException;

public class AudioActivity extends AppCompatActivity {
    AudioEncoder audioEncoder;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_audio);
         audioEncoder=new AudioEncoder();
        audioEncoder.setSavePath(Environment.getExternalStorageDirectory() + "/temp1.aac");
    }

    public void onMViewClicked(View v) {
        switch (v.getId()) {
            case R.id.start:
                try {
                    audioEncoder.prepare();
                    audioEncoder.start();
                } catch (InterruptedException e) {
                    Log.e("AudioActivity","start err==="+e.getMessage());
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }
                break;
            case R.id.stop:
                audioEncoder.stop();
                break;
        }
    }
}
